﻿using StockMatch.Service.AOPCustomAchieve;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StockMatch.Service
{
    public enum InterceptAchieveType
    {
        Before,
        After,
        All
    }
    public class AOPConfig
    {
        private  List<string> _MethodNameList;

        public List<string> MethodNameList
        {
            get { return _MethodNameList; }
        }

        private InterceptAchieveType _InterceptActhieveType;

        public InterceptAchieveType InterceptActhieveType
        {
            get { return _InterceptActhieveType; }
            set { _InterceptActhieveType = value; }
        }

        private AOPInterceptAchieve _AOPInterceptAchieve;

        public AOPInterceptAchieve AOPInterceptAchieve
        {
            get { return _AOPInterceptAchieve; }
            set { _AOPInterceptAchieve = value; }
        }

        public AOPConfig()
        {
            _MethodNameList = new List<string>();
            _InterceptActhieveType = InterceptAchieveType.All;
        }
        public AOPConfig(List<string> methodNameList, InterceptAchieveType interceptActhieveType)
        {
            _MethodNameList = methodNameList;
            _InterceptActhieveType = interceptActhieveType;
        }
        public string TypeName { get; set; }
        public void AddMethodName(string methodName)
        {
            if (string.IsNullOrEmpty(methodName))
            {
                throw new ArgumentNullException("methodName");
            }
            _MethodNameList.Add(methodName);
        }

        public void SetInterceptActhieveType(InterceptAchieveType interceptAchieveType)
        {
            _InterceptActhieveType = interceptAchieveType;
        }

        public void SetAOPInterceptAchieve(AOPInterceptAchieve aopInterceptAchieve)
        {
            if (aopInterceptAchieve == null)
            {
                throw new ArgumentNullException("aopInterceptAchieve");
            }
            _AOPInterceptAchieve = aopInterceptAchieve;
        }
    }
}
